package com.fq.ioc.json;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fq.ioc.constant.CommonConstant;
import com.google.common.io.CharStreams;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;

/**
 * @author jifang
 * @since 16/1/18下午10:26.
 */
public class JsonParse {

    public static JSONArray getPackages(String config) throws IOException {
        Reader reader = new InputStreamReader(ClassLoader.getSystemResourceAsStream(config));
        return JSONObject.parseObject(CharStreams.toString(reader)).getJSONArray(CommonConstant.BASE_PACKAGES);
    }
}
